package com.my.thread.example.jcu;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author: marshal
 * @date: 2021-12-07 3:05 PM
 */
public class LockTest {
    private final Lock lock = new ReentrantLock();
    int value;
    public void add() {
        lock.lock();
        try {
            value += 1;
        } finally {
            lock.unlock();
        }
    }
}
